package com.dreamo.pache.data;

import java.io.ByteArrayOutputStream;

import android.text.format.Time;

import com.google.android.gms.maps.model.LatLng;

public abstract class ITicket {
    
    protected Time time;
    public boolean expired;
    public long secondsElapsed;
    public LatLng Location; 


    public Time getExpiryTime ()
    {
        return time;
    }

    
    public byte[] serialize() {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        byteOut.write(time.second);
        byteOut.write(time.minute);
        byteOut.write(time.hour);
        byteOut.write(time.monthDay);
        byteOut.write(time.month);
        byteOut.write(time.year);
        byteOut.write(expired ? 1 : 0);
        byteOut.write((int)secondsElapsed);
        // TODO: serialize location
        return byteOut.toByteArray();
    }
}
